package swing;

import javax.swing.JFrame;
import javax.swing.JTable;

import swing.components.tablemodels.WeaponTableModel;
import utils.XMLFileHandler;
import container.Weapons;
import enums.StandartFileNames;

/**
 * Frame which is used to display the weapons
 * 
 * @author Marcus
 * 
 */
public class WeaponFrame extends JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = -1752051728638486661L;
	private Weapons weapons;

	public WeaponFrame(String filename) {
		this.weapons = XMLFileHandler.loadWeapons(filename);

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setName("Weapons");
		setTitle("Weapons");

		start();
	}

	public static void main(String args[]) {
		new WeaponFrame("XML_Files/"
				+ StandartFileNames.WEAPON_FILE.getFileName());
	}

	private void start() {
		JTable weaponTable = new JTable(new WeaponTableModel(this.weapons));
		weaponTable.setVisible(true);
		add(weaponTable);
		this.setSize(1000,1000);
		// pack();
		setVisible(true);
	}

}
